import React, { Component } from 'react';
import dynamic from 'dva/dynamic';
import { Route } from 'dva/router';

export default function findRoute(app) {

    const FindOthers = dynamic({
        app,
        models: () => {
            return [
                import('../models/findOthers/othersModel'),
            ];
        },
        component: () => import('../routes/find/findOthers'),
    });
    const FindPeople = dynamic({
        app,
        models: () => {
            return [
                import('../models/findOthers/othersModel'),
            ];
        },
        component: () => import('../routes/find/findPeople'),
    });
    const FindFollow = dynamic({
        app,
        models: () => {
            return [
                import('../models/findOthers/othersModel'),
            ];
        },
        component: () => import('../routes/find/findFollow'),
    });
    const FindIndex = dynamic({
        app,
        models: () => {
            return [
                import('../models/findOthers/othersModel'),
            ];
        },
        component: () => import('../routes/find/findIndex'),
    });

    const PersonHome = dynamic({
        app,
        models: () => {
            return [
                import('../models/findOthers/othersModel'),
            ];
        },
        component: () => import('../routes/find/personHome'),
    });
    const FindSearch = dynamic({
        app,
        models: () => {
            return [
                import('../models/findOthers/othersModel'),
            ];
        },
        component: () => import('../routes/find/findSearch'),
    });
    const Publish = dynamic({
        app,
        models: () => {
            return [
                import('../models/findOthers/othersModel'),
                import('../models/orderList/orderListModel'),
            ];
        },
        component: () => import('../routes/find/publish'),
    });
    const FindDetail = dynamic({
            app,
            models: () => {
                return [
                    import('../models/findOthers/othersModel'),
                    import('../models/orderList/orderListModel'),
                ];
            },
            component: () => import('../routes/find/findDetail'),
        });
    const MyFansList = dynamic({
        app,
        models: () => {
            return [
                import('../models/findOthers/othersModel'),
            ];
        },
        component: () => import('../routes/find/myFansList'),
    });
    const MyArticle = dynamic({
            app,
            models: () => {
                return [
                import('../models/findOthers/othersModel'),
                ];
            },
            component: () => import('../routes/find/myArticle'),
        });
    const TopicPage = dynamic({
        app,
        models: () => {
            return [
                import('../models/findOthers/othersModel'),
            ];
        },
        component: () => import('../routes/find/topicPage'),
    });
    const Attestation = dynamic({
        app,
        models: () => {
            return [
                import('../models/findOthers/othersModel'),
                import('../models/orderList/orderListModel'),
            ];
        },
        component: () => import('../routes/find/attestation'),
    });
    return (
        [
            <Route key="/findOthers" exact strict  path="/findOthers" component={FindOthers}/>,
            <Route key="/publish" exact strict  path="/publish/:data" component={Publish}/>,
            <Route key="/findSearch" exact strict  path="/findSearch" component={FindSearch}/>,
            <Route key="/personHome" exact strict  path="/personHome/:data/:isShow" component={PersonHome}/>,
            <Route key="/findPeople" exact strict  path="/findPeople/:data" component={FindPeople}/>,
            <Route key="/findIndex" exact strict  path="/findIndex/:data" component={FindIndex}/>,
            <Route key="/findDetail" exact strict  path="/findDetail/:data/:scroll" component={FindDetail}/>,
            <Route key="/attestation" exact strict  path="/attestation/:id/:class" component={Attestation}/>,
            <Route key="/findFollow" exact strict  path="/findFollow" component={FindFollow}/>,
            <Route key="/myFansList" exact strict  path="/myFansList" component={MyFansList}/>,
            <Route key="/myArticle" exact strict  path="/myArticle" component={MyArticle}/>,
            <Route key="/topicPage" exact strict  path="/topicPage/:data" component={TopicPage}/>
        ]
    );
}
